﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.IBLL;
using KPIS.GERP.GIMS.IDAL;
using KPIS.GERP.GIMS.DALFactory;
using KPIS.DBM;

namespace KPIS.GERP.GIMS.BLL
{
    public class PrePurchaseRequestItemBLL : IBLLPrePurchaseRequestItem
    {
        private static readonly IDALPrePurchaseRequestItem dal = DataAccess.CreatePrePurchaseRequestItem();

        public PrePurchaseRequestItemBLL()
        {

        }

        public IList<PrePurchaseRequestItemInfo> GetPrePurchaseRequestItem()
        {
            return dal.GetPrePurchaseRequestItem();
        }

        public IList<PrePurchaseRequestItemInfo> GetPrePurchaseRequestItem(string record_status)
        {
            return dal.GetPrePurchaseRequestItem(record_status);
        }

        public PrePurchaseRequestItemInfo GetPrePurchaseRequestItem(int seq)
        {
            return dal.GetPrePurchaseRequestItem(seq);
        }

        public IList<PrePurchaseRequestItemInfo> GetPrePurchaseRequestItemWithParent(int ppr_seq)
        {
            return dal.GetPrePurchaseRequestItemWithParent(ppr_seq);
        }

        public IList<PrePurchaseRequestItemInfo> GetBookMoney(int PrSeq)
        {
            return dal.GetBookMoney(PrSeq);
        }

        public IList<PrePurchaseRequestItemInfo> GetBookMoneyForBidder(int PrSeq)
        {
            return dal.GetBookMoneyForBidder(PrSeq);
        }

        public IList<PrePurchaseRequestItemInfo> GetBookMoneyForBid(int bid_seq)
        {
            return dal.GetBookMoneyForBid(bid_seq);
        }

        public IList<PrePurchaseRequestItemInfo> GetBookMoneyForPurchaseOrder(int po_seq)
        {
            return dal.GetBookMoneyForPurchaseOrder(po_seq);
        }

        public IList<PrePurchaseRequestItemInfo> GetBookMoneyForDeliveryNote(int dn_seq)
        {
            return dal.GetBookMoneyForDeliveryNote(dn_seq);
        }

        public string GetPrePurchaseRequestRule(int ppr_seq)
        {
            return dal.GetPrePurchaseRequestRule(ppr_seq);
        }

        public IList<PrePurchaseRequestItemInfo> GetCollectItemName()
        {
            return dal.GetCollectItemName();
        }

        public void Insert(IList<PrePurchaseRequestItemInfo> infoList, int ppr_seq)
        {
            try
            {
                dal.Insert(infoList, ppr_seq);
            }
            catch
            {
                throw;
            }
        }

        public void Insert(IList<PrePurchaseRequestItemInfo> infoList, int ppr_seq, IDBManager dbManagerTrans)
        {
            try
            {
                dal.Insert(infoList, ppr_seq, dbManagerTrans);
            }
            catch
            {
                throw;
            }
        }

        public void Update(PrePurchaseRequestItemInfo info)
        {
            try
            {
                dal.Update(info);
            }
            catch
            {
                throw;
            }
        }

        public void Delete(PrePurchaseRequestItemInfo info)
        {
            try
            {
                dal.Delete(info);
            }
            catch
            {
                throw;
            }
        }

        public void DeleteAll(IList<PrePurchaseRequestItemInfo> infoList)
        {
            try
            {
                dal.DeleteAll(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void DeleteFromDB(IList<PrePurchaseRequestItemInfo> infoList)
        {
            try
            {
                dal.DeleteFromDB(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void Restore(IList<PrePurchaseRequestItemInfo> infoList)
        {
            try
            {
                dal.Restore(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void UpdateAmount(IList<PrePurchaseRequestItemInfo> infoList, IDBManager dbManagerTrans)
        {
            dal.UpdateAmount(infoList, dbManagerTrans);
        }

        public string CheckPurchaseRequestMoney(int PrSeq, IDBManager dbManagerTrans)
        {
            return dal.CheckPurchaseRequestMoney(PrSeq, dbManagerTrans);
        }

        public string CheckPurchaseRequestMoneyUrgent(int PrSeq, IDBManager dbManagerTrans)
        {
            return dal.CheckPurchaseRequestMoneyUrgent(PrSeq, dbManagerTrans);
        }
    }
}
